Skip to content

fix(output): omit leading space when security module is empty - #254

Merged
pranshuparmar merged 1 commit into
pranshuparmar:stagingfrom
CJstate:fix/security-label-empty-module
Nov 21, 2026
Merged

pranshuparmar merged 1 commit into
pranshuparmar:stagingfrom
CJstate:fix/security-label-empty-module

Conversation

@CJstate

@CJstate CJstate commented Nov 19, 2026

Copy link
Copy Markdown
Contributor

A process can have a confined Linux security label without a reported module name. securityLabel joined the two fields before sanitizing, so the rendered User line began with a stray space before the label.

Skip the module and its separator when the module is empty.

Verification

  • Added the missing case to TestIntegrityAndSecurityLabel (RED: leading space; GREEN: clean label).
  • go test ./...: all packages ok.
  • go vet ./internal/output and git diff --check: clean.

securityLabel concatenated the module and label before sanitizing, so a process with a confined label but no reported module rendered with a leading space. Skip the separator when the module is empty.
@pranshuparmar pranshuparmar added this to the 0.3.5 milestone Nov 21, 2026
@pranshuparmar
pranshuparmar changed the base branch from main to staging November 21, 2026 15:44

@pranshuparmar pranshuparmar left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Main fix looks good. For the record, this has no real-world impact: readSecurityLabel always returns the module and label together, so an empty module with a label can’t happen in real output. It’s a safe defensive change though.

Same change is needed on securityLabel in docs/js/engine.js to mirror the fix in the playground, I can take it up.

@pranshuparmar
pranshuparmar merged commit 5cdc0e6 into pranshuparmar:staging Nov 21, 2026
34 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants